/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package PropertyRental.ejb.persistence;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

/**
 *
 * @author Bast
 */
@Entity
public class Customer extends Users implements Serializable {
    private static final long serialVersionUID = 1L;
    private double maxAmountOfRent;
    @OneToMany
    private List<PropertyRent> properties;
    @OneToMany
    private List<VisitingProperty> visitsRegistered;

    public Customer(){}

    public Customer(String username, String password, String firstName, String lastName, String email, double maxAmountOfRent){
        super(username, password, firstName, lastName, email);
        this.maxAmountOfRent = maxAmountOfRent;
    }

    public List<VisitingProperty> getVisitsRegistered() {
        return visitsRegistered;
    }

    public void setVisitsRegistered(List<VisitingProperty> visitsRegistered) {
        this.visitsRegistered = visitsRegistered;
    }

    public List<PropertyRent> getProperties() {
        return properties;
    }

    public void setProperties(List<PropertyRent> properties) {
        this.properties = properties;
    }
    
    public double getMaxAmountOfRent() {
        return maxAmountOfRent;
    }

    public void setMaxAmountOfRent(double maxAmountOfRent) {
        this.maxAmountOfRent = maxAmountOfRent;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.getId().equals(other.getId()))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "PropertyRental.ejb.beans.Customer[id=" + getId() + "]";
    }

}
